using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace SerbinAV.MobileSales.Sales.Common
{
    public class XMLSerializeDeserialize : ISaveLoader<Settings>
    {
        #region ISerilization<Settings> Members


        public Settings Load(Stream stream)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Settings), string.Empty);
            return (Settings)serializer.Deserialize(stream);
        }

        public void Save(Settings item, Stream stream)
        {
            XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
            xsn.Add(String.Empty, String.Empty);
            XmlSerializer serializer = new XmlSerializer(item.GetType(), new XmlRootAttribute("Settings"));
            serializer.Serialize(stream, item, xsn);
        }
        #endregion
    }
}

